﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Runtime.Serialization;

namespace  CameraAcq
{
    //public delegate void DispImageCallback(HImage img, int _user);
    [Serializable]
    public class AreaCameraBase : CameraBase
    {
        protected int _ImgWidth;         //图像宽
        protected int _ImgHeight;        //图像高
        protected PixelDepth _PixDepth;  //像素位深，8，10，12位等
        protected PixelType _PixType;    //像素类型，黑白或彩色
        protected int _TrigerMode = 2;   //触发模式 
        protected float _ExposeTime;     //曝光时间
        protected float _Framerate;      //帧率
        //[NonSerialized]
        //public DispImageCallback dispImgCallback = null;
        public int m_ImgWidth
        {
            get { return _ImgWidth; }
            set { _ImgWidth = value; }
        }

        public int m_ImgHeight
        {
            get { return _ImgHeight; }
            set { _ImgHeight = value; }
        }
        public PixelDepth m_PixDepth
        {
            get { return _PixDepth; }
        }

        public PixelType m_PixType
        {
            get { return _PixType; }
        }

        [NonSerialized]
        public AutoResetEvent SignalWait = new AutoResetEvent(false);//软触发时信号同步
        public AreaCameraBase(DeviceType _DeviceType)
            : base(_DeviceType)
        {
            m_SensorType = SensorType.Area;
        }
        public AreaCameraBase(string camSerial)
           : base(camSerial)
        {
            m_SerialNo = camSerial;
        }
        //public override void SetTrigger()
        //{
        //    base.SetTrigger();
        //    SignalWait.Set();
        //}
        public override void AcqDeviceList(ref List<CamInfo> cameralist)
        {

        }

        public override bool setExposureTime(float dValue)
        {
            return true;
        }

        /// <summary>
        /// 设置触发模式
        /// </summary>
        /// <param name="mode">触发模式</param>
        /// <returns>成功返回True</returns>
        public override bool SetTriggerMode(TriggerMode mode)
        {
            return true;
        }

        [OnDeserializing()]
        internal void OnDeSerializingMethod(StreamingContext context)
        {
            SignalWait = new AutoResetEvent(false);//采集信号
        }
    }
}
